<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="str in students" :key="str">
                <!-- `split(',')`：以`,`进行字符串分割，结果返回一个数组
                `reverse()`：把分割后的数组翻转下
                `join('-')`：把翻转后的数组重新以-连接为一个字符串 -->
                {{ str.split(',').reverse().join('-') }}
            </li>
        </ul>
    </div>
    <script src="../assets/vue2.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data() {
                return {
                    students: ['男,23,张三,1', '男,22,李四,2', '女,30,王二,3']
                }
            },
        });
    </script>
</body>

</html>